<style type="text/css">
    .table-bordered{
        margin-top: 20px;
    }
    a{cursor: pointer}
</style>

<div class="breadcrumbwidget">
	<ul class="skins">
        <li><a href="default" class="skin-color default"></a></li>
        <li><a href="orange" class="skin-color orange"></a></li>
        <li>&nbsp;</li>
        <li class="fixed"><a href="" class="skin-layout fixed"></a></li>
        <li class="wide"><a href="" class="skin-layout wide"></a></li>
    </ul><!--skins-->
	<ul class="breadcrumb">
        <li><a href="">Trang chủ</a> <span class="divider">/</span></li>
        <li class="active">Quản lý nhóm tuổi</li>
    </ul>
</div><!--breadcrumbwidget-->
<div class="pagetitle">
	<h1>Danh sách nhóm tuổi</h1> <span></span>
</div><!--pagetitle-->

<div class="maincontent">
	<div class="contentinner content-dashboard">
    
    <a class="btn btn-default" href="<?php echo $baseurl.'manage/age-groups/add-age-groups'?>">Thêm mới</a>
    


    <table class="table table-bordered">
        <colgroup>
            <col class="con0" />
            <col class="con1" />
            <col class="con0" />
            <col class="con1" />
        </colgroup>
        <thead>
            <tr>
            	<th class="centeralign">STT</th>
                <th>Nhóm tuổi</th>
                <th>Ghi chú</th>
                <th>Tác vụ</th>
            </tr>
        </thead>
        <tbody>
        <?php if(!in_array($data, array(null, '', '0'))):?>
            <?php $i = 1; foreach($data AS $key=>$value): ?>
                <tr>
                	<td class="centeralign"><?php echo $i; ?></td>
                    <td><?php echo $value->name; ?></td>
                    <td><?php echo $value->note; ?></td>
                    <td class="centeralign">
                        <a href="<?php echo $baseurl.'manage/age-groups/edit-age-groups/'.$value->id?>"><i class="icon-edit"></i></a>
                        <a data-id="<?php echo $value->id?>" class="deleterow-x"><i class="icon-trash"></i></a>
                    </td>
                </tr>
            <?php $i++; endforeach;?>
        </tbody>
    </table>
    
        <?php else: ?>
            </tbody>
        </table>
        <?php endif;?>
    
    </div>
</div>




<script>

jQuery('.deleterow-x').click(function(){
    var ids = $(this).data('id');
	var conf = confirm('Bạn muốn xóa nhóm tuổi này?');
	if(conf)
		jQuery(this).parents('tr').fadeOut(function(){
			jQuery(this).remove();
			$.ajax({
                type: "GET",
			    url: baseUrl+'manage/age-groups/delete-age-groups/'+ids
			});
		});
	return false;
});
</script>